<?php 
/*
 * File name : View.php
 * Description : View.php displays the output to the user. It is called by the controller.
 * Created By : Pratibha Awasthi.
 */
			
			// Ths View.php deals with printing the values to the screen. The content to be displaed is provided by the Controller.
			echo "<h2><br/> Pledge Based Donation</h2> <br/> <br/>";
			
			// Check if the subscriber has made pledge based donations
			if($row_curr['tblSubscriber_SubscriberID'] == NULL){
				echo "<h3> You currently do not have any Pledge Based donations </h3>";
				echo "<br/> <br/> <h2> <a href= 'http://localhost/good-mojo-donation/trunk/src/NewPledge.php'> Click Here </a> to Sign Up for a New Pledge based donation </h2> ";
			}
			// Display the pledge based donations made by the subscriber till date.
			else{
				
				echo <<<EPRINT
				
				<h3> Ongoing Pledge Based donations </h3> <br/><br/>
				<table class = 'pledgeprofile'>
				<tr class= "pledgehead"> <td> Agency </td> <td> Frequency </td> <td> Amount </td> <td> Start Date </td> <td> End date </td> <tr>
					
EPRINT;

				//$result = mysql_query("SELECT * FROM TGS_GM_RESERVATION.tblsubscriberpledge where tblSubscriber_SubscriberID = (SELECT SubscriberID FROM TGS_GM_RESERVATION.tblsubscriber WHERE UserID = '{$userid}')");
				while($row = mysql_fetch_array($result)){
					
					   $agencyid = $row['AgencyID'];
					   $frequencyid = $row['FrequencyID'];
						
					   $agencyname =  mysql_query("SELECT Name FROM TGS_GM_RESERVATION.tblagency where ID = '{$agencyid}'");
					   $agencyname = mysql_fetch_array($agencyname);
					   $frequencyname = mysql_query("SELECT FrequencyType FROM TGS_GM_RESERVATION.lkpfrequency where FrequencyID = '{$frequencyid}'");
					   $frequencyname = mysql_fetch_array($frequencyname);
					   
					   echo <<<EPRINT
					   <tr> <td> {$agencyname['Name']} </td> <td> {$frequencyname['FrequencyType']} </td> <td> {$row['Dollars']} </td> <td> {$row['StartDate']} </td> <td> {$row['EndDate']} </td> <tr>

EPRINT;
				}
				echo "</table>";
				
				// Link to make new Pledge based donations.
				echo "<br/> <br/> <h2> <a href= 'http://localhost/good-mojo-donation/trunk/src/NewPledge.php'> Click Here </a> to Sign Up for a New Pledge based donation </h2> ";
				
			}
?>